home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / TEST / MENU_TES.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.6 KB  |  81 lines

  1. /*
  2.  * $Id: menu_test.java,v 1.11 1996/10/03 19:46:51 hudson Exp $
  3.  * $Author: hudson $
  4.  */
  5. package sub_arctic.test;
  6.  
  7. import sub_arctic.lib.*;
  8. import sub_arctic.output.*;
  9. import sub_arctic.input.*;
  10. import sub_arctic.constraints.std_function;
  11.  
  12. import java.awt.Font;
  13.  
  14. public class menu_test extends interactor_applet implements callback_object {
  15.   public void build_ui(base_parent_interactor top) {
  16.     String[] os={"Windows 3.1","Lignux 2.0 Beta", "Solaris 2.5.1",
  17.          "Windows NT 4.0"};
  18.     String [] solaris_version = {"On Intel","On Sparc", "On Power PC"};
  19.  
  20.     menu_button mb;
  21.     menu m1,m2;
  22.     Font f=new Font("Helvetica",Font.PLAIN, 14);
  23.     int max1=text_menu_item.max_item_width(os,f),
  24.       max2=text_menu_item.max_item_width(solaris_version,f);
  25.     pullright_menu_item pr;
  26.     label l;
  27.  
  28.     m1=new menu();
  29.     m2=new menu();
  30.  
  31.     /* first menu to build is second one displayed */
  32.     m2.add_child(new text_menu_item(solaris_version[0],f,max2));
  33.     m2.add_child(new text_menu_item(solaris_version[1],f,max2));
  34.     m2.add_child(new text_menu_item(solaris_version[2],f,max2));
  35.  
  36.     /* make a label , just for kicks */
  37.     l = new label("Operating Systems",max1,f);
  38.     /* main menu */
  39.     m1.add_child(l);
  40.     m1.add_child(new text_menu_item(os[0],f,max1));
  41.     m1.add_child(new text_menu_item(os[1],f,max1));
  42.     pr=new pullright_menu_item(os[2],f,max1,m2);
  43.     m1.add_child(pr);
  44.     m1.add_child(new text_menu_item(os[3],f,max1));
  45.  
  46.     mb=new menu_button("Click Me!",f,m1);
  47.     mb.set_x(10);
  48.     mb.set_y(10);
  49.  
  50.     /* note that although the trees for the menus are built, they
  51.      are NOT added to the toplevel parent... the menu buttons
  52.      (and pullrights) need flexibility in doing parenting. Later
  53.      they may NOT put them in the top_level parent, but create
  54.      new AWT windows for them ...*/
  55.     top.add_child(mb);
  56.  
  57.   }
  58.   public void callback(interactor from_obj, event evt,int callback_num, 
  59.         Object callback_info)  {
  60.       System.out.println("Callback called!");
  61.           
  62.   }
  63.  
  64. }
  65. /*=========================== COPYRIGHT NOTICE ===========================
  66.  
  67. This file is part of the subArctic user interface toolkit.
  68.  
  69. Copyright (c) 1996 Scott Hudson and Ian Smith
  70. All rights reserved.
  71.  
  72. The subArctic system is freely available for most uses under the terms
  73. and conditions described in 
  74.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  75. and appearing in full in the lib/interactor.java source file.
  76.  
  77. The current release and additional information about this software can be 
  78. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  79.  
  80. ========================================================================*/
  81.